Webalizer - where the hell is the configuration file on Synology disk station and how do I edit it?

10 March 2017

My setup

I have the el cheapo Synology DS215J and it is running the latest DSM software - DSM 6.0.2-8451 Update 9.

I have also Webstation and Webalizer installed. I use a PC loaded with Windows 10.

Webalizer

I have been using webalizer to track traffic to my website and unfortunately the default setup does not track the country of visitors. I understand I can have this turn on but .... the information available on the web are very fragmented and may not apply to my particular setup. So after spending a good few hours setting up everything, I think I will share this with you and make your journey a bit easier.

How can I view the webalizer config file?

Firstly, you wont be able to see the webalizer configuration file on Windows PC - File Explorer or the disk station File app. Period. These files are only viewable using LINUX compaitble software as all Disk Station software run on a modified LINUX OS.

So I need some software to see those files. A search on the web landed me 2 open source softwares that are free to use. The first one is called PuTTY and the second one is called WINSCP. You can easily find software download pages on google. For now, just downloaded those 2 softwares and install onto your Windows PC.

I will explain later why you need to have both softwares.

Diskstation setup

You have to enable SSH (Secure Shell) service on your diskstation to allow the softwares to talk to the diskstation. To do that, go to the "Control Panel" under Synology DSM. Click on "Terminal SNMP" (for me, this is the last icon on the Control panel).

Once there, click on "Enable SSH Service" and leave the default port at "22".

Then click "APPLY". Easy eh!

Where is the webalizer config file?

I haven't told you yet where the file is. There are so many different places mentioned by everyone in the web and maybe due to different set up, none of those are actually applicable to my setup - and I thought my set up is pretty common!

Anyway, the webalizer.conf file is located in /var/packages/Webalizer/target/synology_added/ directory.

Using WINSCP to view the file

Run WINSCP as this is much easier to use than PuTTY but come with a big limitation! I talk about that later.

When the WINSCP Login page come up, fill in -

Hit "Login", if everything was filled in correctly. You should be presented with a windows explorer look alike window. The left hand side is your PC file information. The right hand side is your Diskstation file information.

So to get to the config file, you need to go back to the root directory. Just press the yellow up arrow to go one level up on the right hand window a few times until you cant go up anymore - then you are at the root level.

Here you can see all the wonderful LINUX files that are hidden from you in Windows - you are literally in a different world!!!

So navigate to /var/pakcages/Webalizer/target/synology_added/ directory just by clicking. And double click on the webalizer.conf will open up the file. Before you do that, you can also see that the owner of the file is "root". As you are not logged in as root so you can only view the file and if you modified it, LINUX will not allow you to save the file as you dont have the necessary priviledges.

Wow .. when the file open up you can see many many parameters you can set. But for the purpose of this article, we going to change a couple so that it can start looking up the country of all IP addresses.

So the 2 statement you need to change are -

Hang on, didnt you say we cant save the file. Yes Thomas!

So this is a dry run for you. Now you know where the file is and what you need to change you can use PuTTY to do it.

Using PuTTY to edit the file

Run PuTTY, I am using the 64bit Window release 0.68.

When the confguration page come up, fill in -

Then that is all you need to fill in, click the "OPEN" button

A DOS like window will open. For people old enough to remember DOS..........

You will be promted with "login as: " - simply enter a user account with admin access and press enter.

then you will be prompted with the password - enter the password and press enter. (Hint: the cursor does not move when you type in your password)

If you have done everything correctly, you will be prompted with your user name@ your disk station name :~S

So success so far. But wait, to edit any files where the owner is root, you need to now change the user to root.

So after :~S, type "sudo su -" (obviously without the double quotes - sudo apparently stand for SUpervisor DO - you wish!!!!)

you will be prompted with enter password again, simply enter the password you just entered a couple of steps back and press enter.

It should then display "root@your disk station name". Congrats .. now you have root level Super User access to your LINUX Synology disk station.

Now everything is so machine like in PuTTY, just take your time.

First step is to change directory to the directory that has the conf file.

so at the prompt, type "cd /var/packages/Webalizer/target/synology_added/" (Hint: watch our for upper and lower case as LINUX is case sensitive)

You know you are successful if the prompt actually include the path that you just typed.

Now you can edit the file by typing "vi webalizer.conf" and modified the 2 statements that we mentioned above.

OK a list of all vi command is beyond the socpe of this article. So google LINUX vi command and you can find out how to navigate to the 2 lines you need to change and how you can save and quit.

a couple of helpful command you will need to use would be -

Once you have modified the file then type "exit" at the prompt (Hint: do that a second time). That will close down your PuTTY session.

Wow.... Doing all these are like stepping into computer dark ages ....there are probably much more graphical tool out there ... but this is all I managed to find as freeware! Yes Thomas is a cheapskate!

Result

Now you just have to wait for Webalizer to do its batch look up at a quiet time of the server and then the next time you pull up the webalizer report, on the bottom, instead of seeing unresolved country - you can see the countries! Pat yourself on the back and say I survive!

 

Return to Home Page